﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using HCI.Questionaire.Exceptions;
using System.ComponentModel;

namespace HCI.Questionaire.Entities
{
    public class FillTextQuestion : RatingQuestion, INotifyPropertyChanged
    {
        private bool m_IsRequired;
        public bool IsRequired
        {
            get { return m_IsRequired; }
            set { m_IsRequired = value; }
        }
        public override void ValidateAnswer()
        {
            int count = 0;

            if (this.AnswerCollection == null || this.AnswerCollection.Count == 0 || this.AnswerCollection[0].AnswerResult == null )
            {
                throw new RequiredAnswerException("Required at less on answer.");
            }
        }

        public string AnswerText
        {
            get
            {
                if (this.AnswerCollection[0].AnswerResult != null)
                    return this.AnswerCollection[0].AnswerResult.ToString();
                else
                    return string.Empty;
            }
            set 
            {
                this.AnswerCollection[0].AnswerResult = value;
                OnPropertyChanged("AnswerText");
            }
        }
    }
}
